// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
import java.io.*;
public class Main {
    public static void main(String[] args) {
        String filePath = "source.txt";
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            //请在此处添加代码
            //reader.readLine();
            //System.out.println("食物，每100克铁元素含量（毫克）");
            String line;
            //double max = 0.0;
            //String maxFood = null;
            int totalNumber = 0;
            int doneNumber = 0;
            int notDoneNumber = 0;
            int twentyForNumber = 0;
            int fortyEightNumber = 0;
            int seventyTwoNumber = 0;
            while ((line = reader.readLine()) != null){
                String[] strs = line.split("#");
                //sras[0],strs[1],strs[2],strs[3]
                if(strs[1].equals("Y")){
                    doneNumber++;
                }
                if(strs[2].equals("24")){
                    twentyForNumber++;
                }else if(strs[2].equals("48")){
                    fortyEightNumber++;
                }else{
                    seventyTwoNumber++;
                }
                totalNumber++;
                //int foodWeight = Integer.parseInt(strs[2]);
                //double feWeight = Double.parseDouble(strs[3]);
                //double result = feWeight/foodWeight * 100;
                //if(result > max){
                    //max = result;
                    //maxFood = strs[0];
                //}
                //System.out.println(strs[0]+","+result);
            }
            //System.out.println("单位重量含铁最高的食物是："+maxFood+"，每一百克含有"+max+"毫克铁。");
            System.out.println("单位共有"+totalNumber+"人");
            System.out.println("接种疫苗的人数有"+doneNumber+"未接种疫苗的人数有"+notDoneNumber);
            System.out.println("24小时"+twentyForNumber+",48小时"+fortyEightNumber+",72小时"+seventyTwoNumber);

            File write = new File ("result.txt");
            Writer w = new FileWriter(write);
            BufferedWriter bf = new BufferedWriter(w);
            bf.write("单位共有"+totalNumber);
            bf.write("接种疫苗的人数有"+doneNumber+"未接种疫苗的人数有"+notDoneNumber);
            bf.write(",24小时"+twentyForNumber+",48小时"+fortyEightNumber+",72小时"+seventyTwoNumber);
            bf.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}